# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kimap2
pkgver=0.4.0
pkgrel=1
pkgdesc="Next-generation IMAP library"
arch="all !armhf" # qtdeclarative
url="https://community.kde.org/KDE_PIM"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
depends_dev="
	cyrus-sasl-dev
	kcodecs-dev
	kcoreaddons-dev
	kmime-dev
	qt5-qtbase-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
source="https://invent.kde.org/pim/kimap2/-/archive/v$pkgver/kimap2-v$pkgver.tar.gz"
subpackages="$pkgname-dev"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# loginjobtest is broken https://invent.kde.org/pim/kimap2/-/issues/1
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# Remove installed test files
	rm -r \
		"$pkgdir"/usr/lib/libkimap2test.a \
		"$pkgdir"/usr/include/kimap2test
}
sha512sums="055f9335d2de00deb02b7e10ee9c5fbbb2bd6591319281db168767852fb16806fee4f44503c36379ea358184aed344f35d6404a39af1aca8b9dc9bc584dea07c  kimap2-v0.4.0.tar.gz"
